<?php defined( '_VALID_MOS' ) or die( include_once("../../404.php") );
$sql = "SELECT
concat(`session`.`Title`, '  >>  ', `category`.`CatName`) As `map_path`, `news`.`News_Id`, `news`.`Title` As `newsTitle`,`news`.`alias`,
`news`.`Description`, `news`.`Content`, Date_Format(`news`.`Date`, '%d/%m/%Y lúc: %h:%m') AS `date_add`, `news`.`Order`,`news`.`CatID`
FROM
`news` INNER JOIN `category` ON `category`.`Cat_Id` = `news`.`CatID` INNER JOIN `session` ON `session`.`Ses_Id` = `category`.`SesID`
WHERE `news`.`alias` = ? AND `news`.`Status` = 1";
$cmd = $mysqli->prepare($sql);
$cmd->bind_param("s", $_GET["alias"]);
$cmd->execute() or die($mysqli->error);
$cmd->bind_result($map_path, $News_Id, $Title, $alias, $Description, $Content, $date_add, $Order, $CatID);
$cmd->store_result();
if($cmd->fetch()){
?>
	
<div id="box_article">
<div id="sub_box_article">
	<div class="bg_tt_right"><div class="bg_tt_left"><div class="bg_tt"><div class="text_tt"><?php echo $map_path;?></div></div></div></div>
	<div id="sub_box_article1">
		<div class="ct_right">
			<div class="ct_left">
				<div class="ct">
					<div class="title"><?php echo $Title;?></div>
					<div class="date">Cập nhật ngày: <?php echo $date_add;?></div>
					<div class="content"><?php echo $Content;?></div>
					<div class="util">
						<ul>
							<li>
							<script src="http://cdn.printfriendly.com/printfriendly.js" type="text/javascript"></script><a href="#" style=" color:#6D9F00; text-decoration:none;" class="printfriendly" onclick="window.print(); return false;"><img style="border:none;" src="http://www.chienthang.cantho.vn/templates/default/images/print_p.gif"/></a></li>
							<li><a><img src="templates/default/images/sent_p.gif"></a></li>
							<li><a><img src="templates/default/images/your_idea.gif"></a></li>
							<li><a href="ymsgr:im?msg=<?php echo $Title . ': ' . 'http://'. $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>" style="text-decoration: none;"><img src="templates/default/images/icon_ym.gif"></a></li>
						</ul>
					</div>
					<?php
					$sql1 = "SELECT `news`.`News_Id`, `news`.`Title`, `news`.`alias`, Date_FORMAT(`news`.`Date`, '%d/%m/%Y') As Date
							FROM `category` INNER JOIN `news` ON `category`.`Cat_Id` = `news`.`CatID`
							WHERE `category`.`Cat_Id` = ? AND `news`.`order` < $Order AND `news`.`Status` = 1 
							Order by `news`.`order` desc limit 10";
					$cmd1 = $mysqli->prepare($sql1);
					$cmd1->bind_param("s", $CatID);
					$cmd1->execute() or die($mysqli->error);
					$cmd1->bind_result($subId, $subTitle, $subalias, $subnews_date); 
					$cmd1->store_result();
					if($cmd1->num_rows > 0){ ?>
						<div class="othernews_title">Các tin khác: </div>
						<div class="othernews_text">
							<ul>
								<?php while($cmd1->fetch()){
									echo "<li>";
										echo "<a href=\"./com_content/article/$subalias"; if(isset($_GET["item"])){ echo "/" . $_GET["item"] .".csp" ; }echo "\">$subTitle </a> ($subnews_date)";
									echo "</li>";
								} ?>
							</ul>
						</div>
						<div class="util_bottom">
							<ul>
								<li><a href="<?php echo $_SERVER['REQUEST_URI'] . "#";?>"><img src="templates/default/images/icon_dautrang.gif"></a></li>
								<li><a href="#"><img src="templates/default/images/Icon_Xemtiep.gif"></a></li>
							</ul>
						</div>
					<?php } ?>			
				</div>
				</div>
			</div>
			<div class="bg_bt_right"><div class="bg_bt_left"><div class="bg_bt"><div class="text_bt">&nbsp;</div></div></div></div>
		</div>
	</div>
	<div class="clear"></div>
</div>
<?php
	$cmd1->close();
	$mysqli->close();
}
?>